package com.joshua.viewtest.demo.ElevationAndShadow;

import android.graphics.Outline;
import android.os.Build;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.ViewOutlineProvider;
import android.widget.TextView;

import com.joshua.viewtest.R;

import butterknife.BindDimen;
import butterknife.BindView;
import butterknife.ButterKnife;

public class ShadowAty extends AppCompatActivity {
    @BindView(R.id.test1)
    TextView test1;
    @BindView(R.id.test2)
    TextView test2;
    @BindView(R.id.test3)
    TextView test3;
    @BindView(R.id.test4)
    TextView test4;

    @BindDimen(R.dimen.fab_size)
    int size;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_shadow_aty);
        ButterKnife.bind(this);

        if (Build.VERSION.SDK_INT >= 21) {
            ViewOutlineProvider viewOutlineProvider = new ViewOutlineProvider() {
                @Override
                public void getOutline(View view, Outline outline) {
                    if (Build.VERSION.SDK_INT >= 21)
                        outline.setOval(0, 0, size, size);
                }
            };
            test1.setOutlineProvider(viewOutlineProvider);
            test2.setOutlineProvider(viewOutlineProvider);
            test3.setOutlineProvider(viewOutlineProvider);
            test4.setOutlineProvider(viewOutlineProvider);
        }
    }
}
